package cn.zhfeat.core.utils;


import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.alibaba.fastjson.support.config.FastJsonConfig;

import java.math.BigInteger;

/**
 * @author lu.wang wanglu1@300.cn
 * @description: 修改fastjson序列化方法，Long类型写为String类型，以免页面精度丢失
 * @date 2018/5/17 上午11:38
 */
public class FastJsonConfigExt extends FastJsonConfig {

    public FastJsonConfigExt() {
        super();
        SerializeConfig serializeConfig = SerializeConfig.globalInstance;
        serializeConfig.put(BigInteger.class, ToStringSerializer.instance);
        serializeConfig.put(Long.class, ToStringSerializer.instance);
        serializeConfig.put(Long.TYPE, ToStringSerializer.instance);
        this.setSerializeConfig(serializeConfig);
    }

}
